<%--
 *  File:  zylPlantypeProductGrouopWindow.jsp
 *  Date		  Author		  Changes
 *  2012-9-19	  zahirzhong		  Created
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
	//init param
  	String privilegeCode = "All";
    String strModuleName = "COM";
  	String contextPath = request.getContextPath();
  	
  	
%>
<%@ include file="/inc/CommonHeader.inc" %>
<iframe name="reloadHandler" style="display:none"></iframe>
<html>
<head>
<title>GroupSuitPopWindow</title>
<style type="text/css">
<!--
body{
	margin:0;padding:0;
}
.div1 {
clear: both;
float:left;
height:10px;
border: 0px solid #EEEEEE;
padding:0px;
margin:0px 0px 0px 0px;
}
.div2 {
clear: both;
height:10px;
float:left;
}
.div3 {
clear: both;
height:10px;
float:left;
}
-->
</style>
<PageFlow:CheckPageFlow pageName="p_zylplantypeprodgroup"/>
<%@ include file="/inc/AlertError.inc" %>
<%
  Vector details = (Vector)pageContext.getAttribute("details");
  if(details == null) details = new Vector();
   


  Integer plantypeid = (Integer)pageContext.getAttribute("plantypeid");
  if(plantypeid == null) 
	  plantypeid = new Integer(0);
%>

<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<%
	HashMap Cuserinfo = (HashMap)session.getAttribute("userinfo");
   	if (Cuserinfo==null){
   		Cuserinfo = new HashMap();
   	}
   	String isview=(String)pageContext.getAttribute("isview");
   	
%>
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript">

function page_add(){
    
    if(!checkForm(document.cform))
  		return; 
   
    cform.actionname.value = "add";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_delete()
{
    if(isNullChecked(cform.deleteids))
    {
        alert('<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>');
        return;
    }
    

    if(!confirm('<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>')) return;
    cform.actionname.value = "delete";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}



function frm_select(){
	
	var url = "<%=contextPath%>/FP/SelectCustomerProperty.jsp?plantypeid="+<%=plantypeid%>+"&datacategory="+document.cform.datacategory.value+"&<%= OvalTools.randomURL()%>";
	var windowAttribute = "height=250, width=400,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
  	popwindow = window.open(url,"frm",windowAttribute);
}


function page_setglobalpccode(id,code,name){
	var frm = document.cform;
	frm.grade.value =id;
	frm.typevalue.value =code;
	frm.typename.value = name;
}
function popWindowsContactProd(){


    if(popwindow!=null) popwindow.close();
 	popwindow = window.open("<%=contextPath %>/masterdata/ogm/ProductbrandPopWindow.jsp?<%= OvalTools.randomURL() %>&datacategory=25", "newwindow", "height=400, width=600,top=100,left=200,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=yes")


 	//window.open("contactProdPopWindow.jsp?<%= OvalTools.randomURL() %>&isbottom=1&employeeid=<custom:write name="emplinfo" property="employeeid"/>", "newwindow", "height=400, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no")
}
function set_orgNameByPopWindow(id,code,name){
     var idObj=document.getElementById("productgroupid");
     var codeObj=document.getElementById("prodgroupcode");
     var nameObj=document.getElementById("prodgroupname");
     codeObj.value=code;
	 nameObj.value=name;
	 idObj.value=id;

}
</script>
<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher" >
  <input type="hidden" name="pagename" value="p_zylplantypeprodgroup">
  <input type="hidden" name="actionname">
  <input type="hidden" name="schema" value="v_zylplantypeprodgroup">
    
  <input type="hidden" name="plantypeid" value="<%=plantypeid%>">	
        
  <input type="hidden" name="userid" value="<%=Cuserinfo.get("userid")%>">	
  <input type="hidden" name="numrows" value="<%= details.size() %>">
  <input type="hidden" name="isview" value="<%=isview%>">
<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<tr>
		<td>
		<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0">
		<tr class="deepblue-left"> 
          	<td width="5%" class="deepblue-left">&nbsp;</td>
	  		<td class="title_center" width="40%"><%= label.getLabelName("L_ProdGroupCode") %></td>
	  		<td class="title_center" width="55%"><%= label.getLabelName("L_ProdGroupName") %></td>
        </tr>
	    <span id="olddetail" >
       	<logic:iterate id="suitableusers" collection="<%= details %>" indexId="idx">
       	<tr>
         	<td width="30">
				<custom:checkbox property="zylplantypeprodgroupid" name="suitableusers" changedName="deleteids" styleClass="normalradio" />
         	</td>
	        <td><custom:write name="suitableusers" property="productgroupcode" nbsp="true"  /></td>
	        <td><custom:write name="suitableusers" property="productgroupname" nbsp="true"  /></td>
    	</tr>
        </logic:iterate>
		</span>
	    <%
		if(!("1".equals(isview))){
		%>
		<span id="newdetail" >
       	<tr >
         	<td>&nbsp;</td>
         	<td><input type="text" name="prodgroupcode"   value="<custom:write  property="productgroupcode"   />"  /></td>
         	<td>
         	 <input type="text" name="prodgroupname"   value="<custom:write  property="productgroupname"   />" />
             <a onclick='popWindowsContactProd()'>  <custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
             <custom:hidden  property="productgroupid" command="notnull" label="L_ProdGroupName" />
            </td>
       	</tr>
		</span>
          
		</table>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td>
			</tr>
			<tr>
				<td class="td_center"><a onclick="javascript:page_add();"><custom:button type="1" label="L_Add" imgsrc="finish.gif" border="0" style="width:60" /></a>
				<a onclick="javascript:page_delete();"><custom:button type="1" label="L_Delete" imgsrc="finish.gif" border="0" style="width:60" /></a>
			 <a onclick="parent.window.close();"><custom:button type="1" label="L_Close" imgsrc="close.gif" border="0" style="width:60"/></a></td>
			</tr>
		</table>
		<%} else {%>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td>
			</tr>
			<tr>
				<td class="td_center"><a onclick="parent.window.close();"><custom:button type="1" label="L_Close" imgsrc="close.gif" border="0" style="width:60"/></a></td>
			</tr>
		</table>
		 
		<% }%>
		</td>
	</tr>
</table>

</form>
</body>
</html>